const enterpriseVue = new Vue({
    el: '#app',
    data() {
      return {
        tableData: [],
        rules: {
            Reward_Name: [{
              required: true,
              message: '请输入奖励名称',
              trigger: 'blur',
            }]
          },
        form: {
            Calendar_Scheme_Reward_SerialNumber:'',
            Reward_Name:''
        },
        loading: false,
        list: [],
      }
    },
    mounted() {
    },
    methods: {
      submitForm(formName) {
        let _this = this
        console.log(_this.form);
        _this.$refs[formName].validate((valid) => {
          if (valid) {
            _this.loading = true
            $.ajax({
              url: DomainName + '/getAddAction?token='+$.cookie("token"),
              type: 'POST',
              data: {
                Data: JSON.stringify({
                    calendar_scheme_reward: [_this.form]
                })
              },
              success: function (res) {
                if (res.Result == "成功") {
                  _this.$message({
                    message: '提交成功',
                    type: 'success'
                  });
                  window.history.go(-1);
                } else {
                  _this.$message.error(res.Result);
                }
              },
              error: function () {
                console.log(error)
              },
              complete: function (XMLHttpRequest) {
                _this.loading = false
                if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                  window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                }
              }
            })
          }
          else {
            console.log("error submit!!");
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
    }
  })